//
//  BTHandler.h
//  CoolRollerSkating
//
//  Created by CA on 15/11/30.
//  Copyright © 2015年 Coollang. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^GetInformationBlock)(NSInteger stepCount, NSInteger fallOverCount, NSInteger unixTimeStamp);
typedef void(^GetBatteryBlock)(NSInteger batteryValue);

typedef void(^CompletionBlock)(BOOL successful);

typedef void(^VersionBlock)(BOOL versionSuccessful, NSString *version);
typedef void(^FeedbackDataBlock)(BOOL success, NSString *hand);

typedef void(^RunTimeDataBlock)(BOOL success, SportPoseType actionType,NSInteger speed,NSInteger strength,NSInteger radian,NSInteger hitball,NSInteger topBottomBall,NSInteger forebackBall);// actionType:动作类型  speed:挥拍速度  strength:挥拍力量  radian:挥拍弧度  hitball: 0没有击中球  topBottomBall: 0上手球 forebackBall: 0 正手球
typedef void(^HomePageDataBlock)(BOOL success,NSArray *sportRecordItems);
typedef void(^SportDetailDataBlock)(BOOL success,NSArray *sportDetailItems);
typedef void(^BarChartItemBlock)(BarChartItem *barChartItem);

@interface BTHandler : NSObject

+ (void)handleGetInfomationFeedbackData:(NSData *)data withInformationBlock:(GetInformationBlock)block;

+ (void)handleDeviceNameChangeData:(NSData *)data withCompetitionBlock:(CompletionBlock)completionBlock;

+ (void)handleBatteryData:(NSData *)data withCompletion:(GetBatteryBlock)block;

+ (void)handleRestartDeviceData:(NSData *)data withCompletion:(CompletionBlock)block;

+ (void)handleCloseDeviceData:(NSData *)data withCompletion:(CompletionBlock)block;

+ (void)handleUpdateDeviceData:(NSData *)data withCompletion:(CompletionBlock)block;

+ (void)handleCleanData:(NSData *)data withCompletion:(CompletionBlock)block;

+ (void)handleResetData:(NSData *)data withCompletion:(CompletionBlock)block;

+ (void)handleDeviceVersionData:(NSData *)data withCompletion:(VersionBlock)block;



/**
 *  左右手数据解析
 *
 *  @param data  蓝牙传来的数据
 *  @param block 解析数据的回调block
 */
+ (void)handleHandData:(NSData *)data withCompletion:(FeedbackDataBlock)block;

/**
 *  实时数据解析
 *
 *  @param data  蓝牙传来的数据
 *  @param block 解析数据的回调block
 */
+ (void)handleRuntimeData:(NSData *)data withCompletion:(RunTimeDataBlock)block;

/**
 *  主界面数据解析
 *
 *  @param data  蓝牙传来的主界面数据
 *  @param block 解析数据的回调block
 */
+ (void)handleHomePageData:(NSMutableArray *)homePageArr withCompletion:(HomePageDataBlock)block;

/**
 *  动作详情数据解析
 *
 *  @param data              传入的详情每拍数据
 *  @param barChartItemBlock 详情模型
 *  @param completionBlock   结束接收
 */
+ (void)handleSportDetailData:(NSData *)data barChartItemBlock:(BarChartItemBlock)barChartItemBlock completionBlock:(CompletionBlock)completionBlock;

/**
 *  时间校准
 *
 *  @param data 蓝牙传来的数据
 */
+ (void)handleTimeStampVerifyData:(NSData *)data withCompletion:(CompletionBlock)block;

@end
